
\ --------------------------------
\ rgba32

int extend: rgba32
   union
   byte.field r
   byte.field g
   byte.field b
   byte.field a
end-type

rgba32.make c1
rgba32.make c2

: rgba32.lerp  ( color n. color -- color )
   locals| n |
   c2.!
   c1.!
   c1.r.@ c2.r.@ n lerp c1.r.!
   c1.g.@ c2.g.@ n lerp c1.g.!
   c1.b.@ c2.b.@ n lerp c1.b.!
   c1.a.@ c2.a.@ n lerp c1.a.!
   c1.@ ;

: rgba32.?   @ h. ;

\ --------------------------------
\ Rect

type: rect
   short.field x
   short.field y
   short.field w
   short.field h
end-type

method: rect.@  x.@ y.@ w.@ h.@ ;
method: rect.!  h.! w.! y.! x.! ;
method: rect.?  x.? y.? w.? h.? ;
macro: rect.dims  rect.w.2@ ;
macro: rect.xy   rect.x.2@ ;
macro: rect.dims!  rect.w.2! ;
macro: rect.xy!  rect.x.2! ;


\ --------------------------------
\ Vector

type: vector
   fixed.field x
   fixed.field y
   fixed.field z
end-type

: vector.2?   dup x.? y.? ;
: vector.3?   dup x.? dup y.? z.? ;
: vector.?   vector.3? ;

\ --------------------------------
\ Transform

Type: transform
   vector.field pos
   vector.field rotation
   vector.field scale
   rgba32.field color
End-type

